<template>
	<view class="whitePage">
		<view class="flex">
			<view
				:style="{backgroundImage: `url(${item.image})`}"
				class="item"
				v-for="(item, index) in list"
				:key="index"
				@click="goRoute(item.filed)"
			>
				<view>{{ item.name }}</view>
			</view>
		</view>
	</view>
</template>

<script>
import { imgUrl } from '@/utils/baseUrl.js';
import { getAdminList, managerPrimary } from '@/api/admin.js';
export default {
	data() {
		return {
			imgUrl,
			list: []
		}
	},
	created() {
		getAdminList().then(res => this.list = res)
	},
	methods: {
		// 跳转对应页面
		goRoute(roleCode) {
			let url = `./regionalManager?type=${roleCode}`
			if(roleCode == 'Administrator') {
				url = './superAdmin'
			}
			managerPrimary({ roleCode }).then(res => {
				uni.navigateTo({ url })
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.item {
	width: calc(50% - 10rpx);
	height: 200rpx;
	border-radius: 20rpx;
	border: 1px solid;
	margin-top: 20rpx;
	background-repeat: no-repeat;
	background-size: 100% 100%;
	padding: 40rpx;
	font-weight: bold;
	font-size: 30rpx;
	color: #fff;
}
.flex {
	flex-wrap: wrap;
	padding: 0 20rpx 20rpx 20rpx;
	justify-content: space-between;
}
</style>
